package features.advance.jdk.agent;

import com.sun.tools.attach.VirtualMachine;

/**
 * @author LIN
 * @date 2022-05-06 20:14
 */
public class JMap {

    public static void main(String[] args) {

    }

    private static VirtualMachine attach(String pid){
        try{
            return VirtualMachine.attach(pid);
        }catch(Exception e){
            String msg = e.getMessage();
            if(msg != null){
                System.err.println(pid+":"+msg);
            }else{
                e.printStackTrace();
            }

            System.exit(1);
            return null;
        }
    }
}
